<?php
@mysql_connect('localhost', 'root', 'root');
if (mysql_errno()) {
    die(mysql_errno());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$F=isset($_GET['keywords'])?$_GET['keywords']:"";
$sql = "select * from user where `zhanghao` like '%$F%'";

$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)) {
    $arr[] = $row;
}

mysql_close();
if (!isset($arr)) {
 echo "<script>alert('没有搜到结果');window.location.href='user.php'</script>";
}
include_once '../public/qian.php';
?>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/admin/index.php">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">用户</span></div>
        </div>

         <div class="search-wrap">
            <div class="search-content">
                <form action="user.php" method="get">
                    <table class="search-tab">
                        <tr>

                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="add.php"><i class="icon-font"></i>新增用户</a>

                        <a id="updateOrd" href="user"><i class="icon-font"></i>更新排序</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>


                            <th>ID</th>
                            <th>账号</th>
                            <th>密码</th>
                            <th>昵称</th>
                            <th>email</th>
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                         <?php
foreach ($arr as $v) {
    echo '<tr>
 <td>' . $v['id'] . '</td>
 <td>' . $v['zhanghao'] . '</td>
 <td>' . $v['pwd'] . '</td>
 <td>' . $v['nicheng'] . '</td>
 <td>' . $v['email'] . '</td>
 <td>' . $v['zhuangtai'] . '</td>
 <td>' . date('Y-m-d h:i:s', $v['ctime']) . '</td>

   <td> <a href="update.php?id=' . $v['id'] . '&a=' . $v['zhanghao'] . '&b=' . $v['pwd'] . '&c=' . $v['nicheng'] . '&d=' . $v['email'] . '&e=' . $v['zhuangtai'] . '&f=' . $v['ctime'] . '">修改</a>
   <a href="del.php?id=' . $v['id'].'">删除</a></td>
                                </tr>';

}
?>



                    </table>
                    <div class="list-page"> 2 条 1/1 页</div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
<?php
include_once '../public/hou.php';
?>